home *** CD-ROM | disk | FTP | other *** search
File List | 1991-04-03 | 4.8 KB | 160 lines |
- ' ZeST Interface Demo
- ' 1991, David Becker
- ' -------------------------------------
- init
- draw_gadgets
- monitor_mouse
- PROCEDURE init
- ' check screen resolution
- rez=XBIOS(4)
- IF rez<>2 THEN
- ALERT 3,"| Monochrome only! ",1,"OK",ok%
- ENDIF
- ' fill entire screen with desktop pattern
- CLS
- DEFTEXT 1,0,0,13
- DEFMOUSE 0
- BOUNDARY 0
- DEFFILL 1,2,4
- PBOX 0,0,639,399
- RETURN
- PROCEDURE draw_gadgets
- ' call procedures that draw gadgets
- ' by passing upper x position, upper y, lower x and lower y
- zest_button(100,50,300,100)
- zest_info_box(100,150,300,250)
- zest_text_box(100,300,300,380)
- zest_window(340,50,600,280)
- ' call procedures that draw lines
- zest_line_box(340,300,600,370)
- zest_vert_line(30,40,30,300)
- zest_horiz_line(50,120,250,120)
- ' insert text
- GRAPHMODE 2
- DEFTEXT 1,0,0,13
- TEXT 178,80,"Button"
- TEXT 168,200,"Info Box"
- TEXT 168,345,"Text Box"
- TEXT 447,170,"Window"
- TEXT 439,335,"Line Box"
- GRAPHMODE 0
- RETURN
- PROCEDURE monitor_mouse
- DO
- ' test mouse button
- IF MOUSEK=1 THEN
- ' test mouse x position
- SELECT MOUSEX
- CASE 100 TO 300
- ' test mouse y position
- SELECT MOUSEY
- CASE 50 TO 100
- ' mouse lies within button - press the button
- zest_button_press(100,50,300,100)
- ENDSELECT
- CASE 345 TO 358
- ' test mouse y position
- SELECT MOUSEY
- CASE 54 TO 68
- ' mouse lies within close button on window - press the close button
- zest_button_press(345,54,358,68)
- ENDSELECT
- ENDSELECT
- ENDIF
- LOOP UNTIL MOUSEK=2
- END
- RETURN
- PROCEDURE zest_button(upper_x%,upper_y%,lower_x%,lower_y%)
- DEFLINE 1,1
- DEFFILL 0,2,8
- PBOX upper_x%,upper_y%,lower_x%,lower_y%
- DEFFILL 1,2,4
- PBOX upper_x%+1,upper_y%+1,lower_x%,lower_y%
- LINE upper_x%+1,lower_y%,lower_x%,lower_y%
- LINE upper_x%,lower_y%+1,lower_x%,lower_y%+1
- LINE lower_x%,upper_y%+1,lower_x%,lower_y%
- LINE lower_x%+1,upper_y%,lower_x%+1,lower_y%+1
- RETURN
- PROCEDURE zest_button_press(upper_x%,upper_y%,lower_x%,lower_y%)
- DEFLINE 1,1
- GET upper_x%-1,upper_y%-1,lower_x%+1,lower_y%+1,button$
- GET upper_x%+1,upper_y%+1,lower_x%-2,lower_y%-2,shift_button$
- PUT upper_x%+2,upper_y%+2,shift_button$
- LINE upper_x%,upper_y%,lower_x%,upper_y%
- LINE upper_x%,upper_y%,upper_x%,lower_y%
- COLOR 0
- LINE upper_x%+1,lower_y%,lower_x%,lower_y%
- LINE upper_x%,lower_y%+1,lower_x%,lower_y%+1
- LINE lower_x%,upper_y%+1,lower_x%,lower_y%
- LINE lower_x%+1,upper_y%,lower_x%+1,lower_y%+1
- COLOR 1
- DO
- LOOP UNTIL MOUSEK=0
- PAUSE 3
- PUT upper_x%-1,upper_y%-1,button$
- RETURN
- PROCEDURE zest_info_box(upper_x%,upper_y%,lower_x%,lower_y%)
- DEFLINE 1,1
- DEFFILL 1,2,4
- PBOX upper_x%,upper_y%,lower_x%,lower_y%
- LINE upper_x%,upper_y%,lower_x%,upper_y%
- LINE upper_x%,upper_y%+1,lower_x%,upper_y%+1
- LINE upper_x%,upper_y%,upper_x%,lower_y%
- LINE upper_x%+1,upper_y%,upper_x%+1,lower_y%
- COLOR 0
- LINE upper_x%+1,lower_y%,lower_x%,lower_y%
- LINE upper_x%,lower_y%+1,lower_x%,lower_y%+1
- LINE lower_x%,upper_y%+1,lower_x%,lower_y%
- LINE lower_x%+1,upper_y%,lower_x%+1,lower_y%+1
- COLOR 1
- RETURN
- PROCEDURE zest_text_box(upper_x%,upper_y%,lower_x%,lower_y%)
- DEFLINE 1,1
- DEFFILL 1,2,4
- PBOX upper_x%,upper_y%,lower_x%,lower_y%
- LINE upper_x%,upper_y%,lower_x%,upper_y%
- LINE upper_x%,upper_y%+1,lower_x%,upper_y%+1
- LINE upper_x%,upper_y%,upper_x%,lower_y%
- LINE upper_x%+1,upper_y%,upper_x%+1,lower_y%
- COLOR 0
- LINE upper_x%+1,lower_y%,lower_x%,lower_y%
- LINE upper_x%,lower_y%+1,lower_x%,lower_y%+1
- LINE lower_x%,upper_y%+1,lower_x%,lower_y%
- LINE lower_x%+1,upper_y%,lower_x%+1,lower_y%+1
- COLOR 1
- DEFFILL 0,2,8
- PBOX upper_x%+2,upper_y%+2,lower_x%-2,lower_y%-2
- RETURN
- PROCEDURE zest_horiz_line(upper_x%,upper_y%,lower_x%,lower_y%)
- DEFLINE 1,1
- LINE upper_x%,upper_y%,lower_x%,lower_y%
- COLOR 0
- LINE upper_x%,upper_y%+1,lower_x%,lower_y%+1
- COLOR 1
- RETURN
- PROCEDURE zest_vert_line(upper_x%,upper_y%,lower_x%,lower_y%)
- DEFLINE 1,1
- LINE upper_x%,upper_y%,lower_x%,lower_y%
- COLOR 0
- LINE upper_x%+1,upper_y%,lower_x%+1,lower_y%
- COLOR 1
- RETURN
- PROCEDURE zest_line_box(upper_x%,upper_y%,lower_x%,lower_y%)
- DEFLINE 1,1
- COLOR 0
- BOX upper_x%,upper_y%,lower_x%,lower_y%
- COLOR 1
- LINE upper_x%-1,upper_y%,upper_x%-1,lower_y%
- LINE upper_x%+2,lower_y%-1,lower_x%-2,lower_y%-1
- LINE lower_x%-1,upper_y%+2,lower_x%-1,lower_y%-2
- LINE upper_x%-1,upper_y%-1,lower_x%,upper_y%-1
- RETURN
- PROCEDURE zest_window(upper_x%,upper_y%,lower_x%,lower_y%)
- ' title bar
- GOSUB zest_button(upper_x%,upper_y%,lower_x%,upper_y%+20)
- ' window area
- GOSUB zest_button(upper_x%,upper_y%+22,lower_x%,lower_y%)
- ' close button
- GOSUB zest_button(upper_x%+5,upper_y%+4,upper_x%+18,upper_y%+16)
- RETURN
-